home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / Aliases.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  5.5 KB  |  200 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Aliases.a
  3. ;
  4. ;    Contains:    Alias Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__ALIASES__') = 'UNDEFINED' THEN
  21. __ALIASES__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__APPLETALK__') = 'UNDEFINED' THEN
  30.     include 'AppleTalk.a'
  31.     ENDIF
  32. ;        include 'OSUtils.a'                                        ;
  33. ;            include 'MixedMode.a'                                    ;
  34. ;            include 'Memory.a'                                        ;
  35.  
  36.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  37.     include 'Files.a'
  38.     ENDIF
  39. ;        include 'Finder.a'                                            ;
  40.  
  41. rAliasType                        EQU        'alis'                ; Aliases are stored as resources of this type 
  42. ; define alias resolution action rules mask 
  43. kARMMountVol                    EQU        $00000001            ; mount the volume automatically 
  44. kARMNoUI                        EQU        $00000002            ; no user interface allowed during resolution 
  45. kARMMultVols                    EQU        $00000008            ; search on multiple volumes 
  46. kARMSearch                        EQU        $00000100            ; search quickly 
  47. kARMSearchMore                    EQU        $00000200            ; search further 
  48. kARMSearchRelFirst                EQU        $00000400            ; search target on a relative path first 
  49. ; define alias record information types 
  50. asiZoneName                        EQU        -3                    ; get zone name 
  51. asiServerName                    EQU        -2                    ; get server name 
  52. asiVolumeName                    EQU        -1                    ; get volume name 
  53. asiAliasName                    EQU        0                    ; get aliased file/folder/volume name 
  54. asiParentName                    EQU        1                    ; get parent folder name 
  55.  
  56. ; define the alias record that will be the blackbox for the caller 
  57. AliasRecord             RECORD    0
  58. userType                 ds.l   1        ; offset: $0 (0)        ; appl stored type like creator type 
  59. aliasSize                 ds.w   1        ; offset: $4 (4)        ; alias record size in bytes, for appl usage 
  60. sizeof                     EQU *            ; size:   $6 (6)
  61.                         ENDR
  62.  
  63. ; typedef struct AliasRecord  AliasRecord
  64. ; typedef AliasRecord         *AliasPtr, **AliasHandle
  65. ; alias record information type 
  66. ; typedef short             AliasInfoType
  67. ;
  68. ; pascal OSErr NewAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle *alias)
  69. ;
  70.     IF ¬ GENERATINGCFM THEN
  71.         Macro
  72.         _NewAlias
  73.             moveq    #2,d0
  74.             dc.w     $A823
  75.         EndM
  76.     ELSE
  77.         IMPORT_CFM_FUNCTION    NewAlias
  78.     ENDIF
  79.  
  80. ; create a minimal new alias for a target and return alias record handle 
  81. ;
  82. ; pascal OSErr NewAliasMinimal(const FSSpec *target, AliasHandle *alias)
  83. ;
  84.     IF ¬ GENERATINGCFM THEN
  85.         Macro
  86.         _NewAliasMinimal
  87.             moveq    #8,d0
  88.             dc.w     $A823
  89.         EndM
  90.     ELSE
  91.         IMPORT_CFM_FUNCTION    NewAliasMinimal
  92.     ENDIF
  93.  
  94. ; create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  
  95. ;
  96. ; pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength, const void *fullPath, ConstStr32Param zoneName, ConstStr31Param serverName, AliasHandle *alias)
  97. ;
  98.     IF ¬ GENERATINGCFM THEN
  99.         Macro
  100.         _NewAliasMinimalFromFullPath
  101.             moveq    #9,d0
  102.             dc.w     $A823
  103.         EndM
  104.     ELSE
  105.         IMPORT_CFM_FUNCTION    NewAliasMinimalFromFullPath
  106.     ENDIF
  107.  
  108. ; given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. 
  109. ;
  110. ; pascal OSErr ResolveAlias(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged)
  111. ;
  112.     IF ¬ GENERATINGCFM THEN
  113.         Macro
  114.         _ResolveAlias
  115.             moveq    #3,d0
  116.             dc.w     $A823
  117.         EndM
  118.     ELSE
  119.         IMPORT_CFM_FUNCTION    ResolveAlias
  120.     ENDIF
  121.  
  122. ; given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. 
  123. ;
  124. ; pascal OSErr GetAliasInfo(AliasHandle alias, AliasInfoType index, Str63 theString)
  125. ;
  126.     IF ¬ GENERATINGCFM THEN
  127.         Macro
  128.         _GetAliasInfo
  129.             moveq    #7,d0
  130.             dc.w     $A823
  131.         EndM
  132.     ELSE
  133.         IMPORT_CFM_FUNCTION    GetAliasInfo
  134.     ENDIF
  135.  
  136. ;  Given a file spec, return target file spec if input file spec is an alias.
  137. ;  It resolves the entire alias chain or one step of the chain.  It returns
  138. ;  info about whether the target is a folder or file; and whether the input
  139. ;  file spec was an alias or not. 
  140. ;
  141. ;
  142. ; pascal OSErr ResolveAliasFile(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased)
  143. ;
  144.     IF ¬ GENERATINGCFM THEN
  145.         Macro
  146.         _ResolveAliasFile
  147.             moveq    #12,d0
  148.             dc.w     $A823
  149.         EndM
  150.     ELSE
  151.         IMPORT_CFM_FUNCTION    ResolveAliasFile
  152.     ENDIF
  153.  
  154. ;
  155. ; pascal OSErr FollowFinderAlias(ConstFSSpecPtr fromFile, AliasHandle alias, Boolean logon, FSSpec *target, Boolean *wasChanged)
  156. ;
  157.     IF ¬ GENERATINGCFM THEN
  158.         Macro
  159.         _FollowFinderAlias
  160.             moveq    #15,d0
  161.             dc.w     $A823
  162.         EndM
  163.     ELSE
  164.         IMPORT_CFM_FUNCTION    FollowFinderAlias
  165.     ENDIF
  166.  
  167. ;   Low Level Routines 
  168. ; Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  169. ;
  170. ;
  171. ; pascal OSErr MatchAlias(ConstFSSpecPtr fromFile, unsigned long rulesMask, AliasHandle alias, short *aliasCount, FSSpecArrayPtr aliasList, Boolean *needsUpdate, AliasFilterUPP aliasFilter, void *yourDataPtr)
  172. ;
  173.     IF ¬ GENERATINGCFM THEN
  174.         Macro
  175.         _MatchAlias
  176.             moveq    #5,d0
  177.             dc.w     $A823
  178.         EndM
  179.     ELSE
  180.         IMPORT_CFM_FUNCTION    MatchAlias
  181.     ENDIF
  182.  
  183. ; given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. 
  184. ;
  185. ; pascal OSErr UpdateAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle alias, Boolean *wasChanged)
  186. ;
  187.     IF ¬ GENERATINGCFM THEN
  188.         Macro
  189.         _UpdateAlias
  190.             moveq    #6,d0
  191.             dc.w     $A823
  192.         EndM
  193.     ELSE
  194.         IMPORT_CFM_FUNCTION    UpdateAlias
  195.     ENDIF
  196.  
  197.     ENDIF ; __ALIASES__
  198.